Skip to content

fix: detect xlings package path and fallback MCPP_HOME to ~/.mcpp#60

Merged
Sunrisepeak merged 1 commit into
mainfrom
fix/xlings-package-home-detection
May 20, 2026
Merged

fix: detect xlings package path and fallback MCPP_HOME to ~/.mcpp#60
Sunrisepeak merged 1 commit into
mainfrom
fix/xlings-package-home-detection

Conversation

@Sunrisepeak
Copy link
Copy Markdown
Member

Summary

  • Fix home_dir() to detect when mcpp runs from a xlings package (data/xpkgs/xim-x-mcpp/) and fallback to ~/.mcpp/ instead of creating a nested sandbox
  • Extract default_mcpp_home() with unified Windows (%USERPROFILE%) and POSIX ($HOME) fallback

Problem

When mcpp is installed via xlings install mcpp, home_dir() treats the xlings package directory as MCPP_HOME, creating a nested xlings sandbox (~/.xlings/.../mcpp/0.0.20/registry/data/xpkgs/). This causes mcpp toolchain install llvm to fail with "xpkg payload missing" because xlings doesn't properly handle the deeply nested XLINGS_HOME.

Fix

Check for data/xpkgs ancestor pattern in the binary path → fallback to ~/.mcpp/ (same as CI behavior with explicit MCPP_HOME).

Test plan

  • CI passes on all three platforms
  • Release tarball self-contained mode unaffected (no xpkgs ancestor)
  • Dev builds unaffected (target ancestor still detected)
  • xlings install mcppmcpp toolchain install llvm works with ~/.mcpp/ as HOME

When mcpp is installed via `xlings install mcpp`, the binary lives at
~/.xlings/data/xpkgs/xim-x-mcpp/<ver>/bin/mcpp. The previous
home_dir() detected bin/ and used the grandparent (the xpkgs package
directory) as MCPP_HOME, creating a nested xlings sandbox that broke
toolchain installation and lost installed toolchains on mcpp upgrade.

Now home_dir() checks for the data/xpkgs ancestor pattern and falls
back to ~/.mcpp/ (same behavior as CI with explicit MCPP_HOME).

Also extract default_mcpp_home() with unified Windows (%USERPROFILE%)
and POSIX ($HOME) fallback logic.
@Sunrisepeak Sunrisepeak merged commit 063fb6f into main May 20, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant